package com.example.feature.demo.config;

import com.alibaba.druid.support.spring.stat.DruidStatInterceptor;
import org.springframework.aop.support.RegexpMethodPointcutAdvisor;
import org.springframework.context.annotation.Bean;

/**
 * DruidAopConfiguration
 *
 * @author zhouxianfeng
 * @date 2021-5-19
 */
//@Configuration
public class DruidAopConfiguration {

    @Bean
    public DruidStatInterceptor druidStatInterceptor() {
        return new DruidStatInterceptor();
    }

    @Bean
    public RegexpMethodPointcutAdvisor druidStatPointcut(DruidStatInterceptor druidStatInterceptor) {
        RegexpMethodPointcutAdvisor advisor = new RegexpMethodPointcutAdvisor();
        advisor.setPatterns("com.example.feature.demo.service.*");
        advisor.setAdvice(druidStatInterceptor);
        return advisor;
    }


}
